<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>

<%@page import="it.univaq.di.helpdesk.business.model.User"%>
<%@page import="it.univaq.di.helpdesk.common.utils.MenuManager"%>
<%@page import="java.util.List"%>
<%@page import="it.univaq.di.helpdesk.business.model.Menu" %>
<%@page import="java.util.Enumeration"%>

<%  
User user = (User)session.getAttribute("user");
List<Menu> userMenu = MenuManager.getUserMenu(user.getRoles());

String request_uri = request.getAttribute("javax.servlet.forward.request_uri").toString();
String mask = request.getContextPath();
request_uri =  request_uri.substring(mask.length());
request.setAttribute("request_uri",request_uri);
%>
<!--Blocco Menu-->
<div id="menu">
    <div id="mi"><img src="<c:url value="/layout/images/menu/mi.png" />" alt="" /></div>	
	<ul>    
        <c:forEach items="<%=userMenu%>" var="entry">
            <li>
                <c:choose>
                    <c:when test="${requestScope.request_uri == entry.url}">
                        <a class="current" href="<c:url value="${entry.url}"/>">${entry.name}</a>
                    </c:when>
                    <c:otherwise>
                        <a href="<c:url value="${entry.url}"/>">${entry.name}</a>
                    </c:otherwise>
                </c:choose>
                <img src="<c:url value="/layout/images/menu/ms.png"/>" alt="" />
            </li>
        </c:forEach>
		<li><a id="logout" style="color:#CF3333; font-style: oblique; border:none;" href="<c:url value="/common/logout.do" />">Logout</a></li>			
	</ul>
	<div id="mf"><img src="<c:url value="/layout/images/menu/mf.png" />" alt="" /></div>
</div>